package com.aim.util.filters;

import junit.framework.TestCase;

import java.util.Arrays;

/**
 * User: Avraham Shvartzon
 * Date: 9/12/14
 */
public class TestChainFilter extends TestCase {

    public void testChain() throws Exception {
        ChainFilter<Integer> f1 = new ChainFilter<Integer>("f1") {
            @Override
            public boolean accept(Integer value) {
                return value > 5;
            }
        };

        ChainFilter<Integer> f2 = new ChainFilter<Integer>("f2") {

            @Override
            public boolean accept(Integer value) {
                return value < 15;
            }
        };

        ChainFilter<Integer> filter = ChainFilter.createFilter(f1, f2);
        System.out.println(filter.getName());
        assertFalse(filter.accept(3));
        assertTrue(filter.accept(10));
        assertFalse(filter.accept(17));
    }
}
